Schema & Value Types
Schema & Value Types
ColumnInfo
ColumnInfo describes the structure of a single column in a table.
It is typically used for schema inspection, debugging, and migration logic.
This type is returned by Database.columnsIn().
Fields
-
nameThe column name. -
typeThe declared SQLite column type (for exampleinteger,text,real). -
defaultValueSQLThe SQL expression used as the default value, ornullif none is defined. -
isNotNullWhether the column is declared asNOT NULL. -
primaryKeyIndexThe position of this column in the primary key:0means the column is not part of the primary key>= 1indicates the order within a composite primary key
Example
PrimaryKeyInfo
PrimaryKeyInfo describes the primary key definition of a table.
This type is returned by Database.primaryKey().
Fields
-
columnsThe list of column names that form the primary key (supports composite keys). -
rowIDColumnThe column name mapped to SQLite’s internalrowid, ornullif not applicable. -
isRowIDIndicates whether the table uses SQLite’s implicitrowidas its primary key.
Example
ForeignKeyInfo
ForeignKeyInfo describes a foreign key constraint defined on a table.
This type is returned by Database.foreignKeys().
Fields
-
idInternal identifier of the foreign key constraint. -
originColumnsColumns in the current table that form the foreign key. -
destinationTableThe referenced table name. -
destinationColumnsColumns in the referenced table. -
mappingOne-to-one mapping between origin and destination columns.
Example
IndexInfo
IndexInfo describes an index defined on a table.
This type is returned by Database.indexes().
Fields
-
nameThe index name. -
columnsColumns included in the index. -
isUniqueWhether the index enforces uniqueness. -
originIndicates how the index was created:createIndex: created viaCREATE INDEXprimaryKeyConstraint: generated from a primary keyuniqueConstraint: generated from a unique constraint
Example
DatabaseValue
DatabaseValue represents all value types supported by SQLite parameter binding and default values.
Typical Usage
- SQL parameter binding
ColumnDefinition.defaultValueStatementArguments
Example
StatementArguments
StatementArguments defines the supported argument formats for SQL statements.
Examples
Positional arguments:
Named arguments:
TransactionCompletion
TransactionCompletion controls the final outcome of a transaction or savepoint.
Example
DatabaseCollation
DatabaseCollation defines string comparison and sorting rules.
Example
ForeignKeyAction
ForeignKeyAction defines how foreign keys behave on update or delete.
Example
ColumnReferences
ColumnReferences describes a column-level foreign key reference.
ColumnDefinition
ColumnDefinition defines a column when creating or altering a table.
Example
Summary
These basic types form the structural foundation of the SQLite API:
-
ColumnInfo,PrimaryKeyInfo,ForeignKeyInfo,IndexInfoFor inspecting and understanding database schema -
ColumnDefinition,ColumnReferences,ForeignKeyActionFor declaring and creating schema -
DatabaseValue,StatementArgumentsFor safe and explicit data binding
